package com.capacitydorm.server.service;

import com.capacitydorm.server.dao.TowerMapper;
import com.capacitydorm.server.domain.Tower;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class HouseService {

    @Resource
    private TowerMapper towerMapper;

    public List<Tower> selectAll() {
        return towerMapper.selectAll();
    }

    public void add(Tower tower) {
        towerMapper.insert(tower);
    }

    public void delete(Integer id) {
        towerMapper.deleteByPrimaryKey(id);
    }

    public void update(Integer id, Tower tower) {
        tower.setId(id);
        towerMapper.updateByPrimaryKey(tower);
    }

    public List<Tower> check(Tower tower) {
        List<Tower> select = towerMapper.select(tower);
        return select;
    }
}
